import 'package:app_30/models/detail_entity.dart';
import 'package:app_30/models/load_entity.dart';
import 'package:app_30/models/referral_entity.dart';
import 'package:app_30/net/dio_utils.dart';
import 'package:app_30/net/http_api.dart';
import 'package:app_30/res/constant.dart';
import 'package:app_30/util/cache_utils.dart';
import 'package:app_30/util/toast_utils.dart';
import 'package:flutter/widgets.dart';

class TiChengListViewModel extends ChangeNotifier {
  String title = '提现记录';
  LoadEntity? loadData;

  List<DetailEntity> data=[];

  void initialise() {

    title = '提现记录';
    loadData = getLoadData();
    notifyListeners();
    searchTxjl();
  }

  // Constant.fcjl; 分成记录
// Constant.txjl; 提现记录
  searchTxjl() async {
    Map<String, dynamic> map = Map();
    map['user'] = "${loadData?.user}";
    map['mysqlid'] = "${loadData?.id}";
    // map['type'] = Constant.fcjl;
    map['type'] = Constant.txjl;
    map['num'] = "";

    await DioUtils.instance.requestNetwork<List<DetailEntity>>(
      Method.post,
      HttpApi.chaxun,
      params: map,
      onSuccess: (dat) {
        data = dat!;
        notifyListeners();
      },
      onError: (_, __) {
        Toast.show('${__}');
      },
    );
  }


}
